/** 
 * Mise en oeuvre de Piece.h
 *
 * @file Piece.cxx
 */

// A besoin de la declaration de la classe
#include "Piece.h"

Piece::Piece()
{
    m_x = 0;
    m_y = 0;
}

Piece::Piece(int x, int y, bool white)
{
    //std::cout <<"Piece editee" << std::endl;
    init(x, y, white);
}

Piece::~Piece()
{
    //std::cout <<"Piece decedee" << std::endl;
}

void
        Piece::init( int x, int y, bool white )
{
    move(x,y);
    m_white = white;
}

void
        Piece::move( int x, int y )
{
    m_x = x;
    m_y = y;
}

int
        Piece::x()
{
    return m_x;
}

int
        Piece::y()
{
    return m_y;
}

bool
        Piece::isWhite()
{
    return m_white;
}

bool
        Piece::isBlack()
{
    return !isWhite();
}

void Piece::setWhite(bool white)
{
    m_white = white;
}

bool Piece::caseOccupee(Piece &P2)
{
    return(m_x==P2.x() && m_y==P2.y());
}

std::string Piece::toString()
{
    cout << "PosX " << m_x << "|| PosY " << m_y << endl;
    return ("PosX=");
}


